package initialize

import (
	"faker/project-public/global"
	"faker/project-public/middleware"
	"faker/project-public/router"
	"github.com/gin-gonic/gin"
)

func Routers() *gin.Engine {
	Router := gin.Default()
	systemRouter := router.SysRouterGroup.SysRouters
	PublicGroup := Router.Group(global.FAKER_CONFIG.System.RouterPrefix)
	{
		systemRouter.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
	}
	//需要鉴权
	PrivateGroup := Router.Group(global.FAKER_CONFIG.System.RouterPrefix)
	PrivateGroup.Use(middleware.JWTAuth())
	{
		systemRouter.InitUserRouter(PrivateGroup)
		systemRouter.InitRoleRouter(PrivateGroup)
		systemRouter.InitRuleRouter(PrivateGroup)
	}
	return Router
}
